<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<title>OpenCV: F-transform theory</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../tutorial-utils.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
  TeX: {
      Macros: {
          matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
          fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
          forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
          forkfour: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ #7 & \\mbox{#8}\\\\ \\end{array} \\right.", 8],
          vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
          vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
          cameramatrix: ["#1 = \\begin{bmatrix} f_x & 0 & c_x\\\\ 0 & f_y & c_y\\\\ 0 & 0 & 1 \\end{bmatrix}", 1],
          distcoeffs: ["(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6 [, s_1, s_2, s_3, s_4[, \\tau_x, \\tau_y]]]]) \\text{ of 4, 5, 8, 12 or 14 elements}"],
          distcoeffsfisheye: ["(k_1, k_2, k_3, k_4)"],
          hdotsfor: ["\\dots", 1],
          mathbbm: ["\\mathbb{#1}", 1],
          bordermatrix: ["\\matrix{#1}", 1]
      }
  }
}
);
//]]>
</script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenCV
   &#160;<span id="projectnumber">4.5.2</span>
   </div>
   <div id="projectbrief">Open Source Computer Vision</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('../../',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../d3/d81/tutorial_contrib_root.html">Tutorials for contrib modules</a></li><li class="navelem"><a class="el" href="../../d7/d36/tutorial_fuzzy.html">Fuzzy image processing tutorials</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">F-transform theory </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1>Goal </h1>
<p>In this tutorial, the basic concept of fuzzy transform is presented. You will learn:</p>
<ul>
<li>mathematic background,</li>
<li>how to apply concept of fuzziness to image processing.</li>
</ul>
<p>The presented explanation demands knowledge of basic math. All related papers are cited and mostly accessible on <a href="https://www.researchgate.net/">https://www.researchgate.net/</a>.</p>
<h1>Introduction </h1>
<p>In the last years, the theory of F-transforms has been intensively developed in many directions. In image processing, it has had successful applications in image compression and reduction, image fusion, edge detection and image reconstruction <a class="el" href="../../d0/de3/citelist.html#CITEREF_Perf:FT">[197]</a> <a class="el" href="../../d0/de3/citelist.html#CITEREF_MSLP:cod-decod">[56]</a> <a class="el" href="../../d0/de3/citelist.html#CITEREF_Fusion:AFS12">[256]</a> <a class="el" href="../../d0/de3/citelist.html#CITEREF_IPMU2012">[195]</a> <a class="el" href="../../d0/de3/citelist.html#CITEREF_Perf:rec">[194]</a> <a class="el" href="../../d0/de3/citelist.html#CITEREF_vlavsanek2015patch">[262]</a>. The F-transform is a technique that places a continuous/discrete function in correspondence with a finite vector of its F-transform components. In image processing, where images are identified by intensity functions of two arguments, the F-transform of the latter is given by a matrix of components.</p>
<p>Let me introduce F-transform of a 2D grayscale image \(I\) that is considered as a function \(I:[0,M]\times [0,N]\to [0,255]\) where \([0,M]=\{0,1,2,\ldots,M\}; [0,N]=\{0,1,2,\ldots,N\}\). It is assumed that the image is defined at points (pixels) that belong to the set \(P\), where \(P=\{(x,y)\mid x=0,1,\ldots, M;y=0,1,\ldots, N\}\).</p>
<p>Let \(A_0, \dots ,A_m\) and \(B_0, \dots ,B_n\) be basic functions, \(A_0, \dots ,A_m : [0,M] \to [0, 1]\) be fuzzy partition of \([0,M]\) and \(B_0, \dots ,B_n :[0,N]\to [0, 1]\) be fuzzy partition of \([0,N]\). Assume that the set of pixels \(P\) is <em>sufficiently dense with respect to the chosen partitions</em>. This means that for all \(k\in{0,\dots, m}(\exists x\in [0,M]) \ A_k(x)&gt;0\), and for all \(l\in{0,\dots, n}(\exists y\in [0,N])\ B_l(y)&gt;0\).</p>
<h1>\(F^0\)-transform </h1>
<p>We say that the \(m\times n\)-matrix of real numbers \(F^0_{mn}[I] = (F^0_{kl})\) is called <em>the (discrete) F-transform</em> of \(I\) with respect to \(\{A_0, \dots,A_m\}\) and \(\{B_0, \dots,B_n\}\) if for all \(k=0,\dots,m,\ l=0,\dots,n\):</p>
<p class="formulaDsp">
\[ F^0_{kl}=\frac{\sum_{y=0}^{N}\sum_{x=0}^{M} I(x,y)A_k(x)B_l(y)}{\sum_{y=0}^{N}\sum_{x=0}^{M} A_k(x)B_l(y)}. \]
</p>
<p>The coefficients \(F^0_{kl}\) are called <em>components</em> of the \(F^0\)-transform.</p>
<h1>\(F^1\)-transform </h1>
<p>\(F^1\)-transform has been presented in <a class="el" href="../../d0/de3/citelist.html#CITEREF_perfilieva2014differentiation">[196]</a>. We say that matrix \(F^1_{mn}[I] = (F^1_{kl}), k=0,\ldots, m, l=0,\ldots, n\), is the \(F^1\)-transform of \(I\) with respect to \(\{A_k\times B_l\mid k=0,\ldots, m, l=0,\ldots, n\}\), and \(F^1_{kl}\) is the corresponding \(F^1\)-transform component.</p>
<p>The \(F^1\)-transform components of \(I\) are linear polynomials in the form</p>
<p class="formulaDsp">
\[ F^1_{kl}(x,y)= c^{00}_{kl} + c^{10}_{kl}(x-x_k) + c^{01}_{kl}(y-y_l), \]
</p>
<p>where the coefficients are given by</p>
<p class="formulaDsp">
\[ c_{kl}^{00} =\frac{\sum_{y=0}^{N}\sum_{x=0}^{M} I(x,y)A_k(x)B_l(y)}{\sum_{y=0}^{N}\sum_{x=0}^{M} A_k(x)B_l(y)}, \\ c_{kl}^{10} =\frac{\sum_{y=0}^{N}\sum_{x=0}^{M} I(x,y)(x - x_k)A_k(x)B_l(y)}{\sum_{y=0}^{N}\sum_{x=0}^{M} (x - x_k)^2A_k(x)B_l(y)}, \\ c_{kl}^{01} =\frac{\sum_{y=0}^{N}\sum_{x=0}^{M} I(x,y)(y - y_l)A_k(x)B_l(y)}{\sum_{y=0}^{N}\sum_{x=0}^{M} (y - y_l)^2A_k(x)B_l(y)}. \]
</p>
<h1>Application to image processing </h1>
<p>The technique of F-transforms uses two steps: <em>direct and inverse</em>. The direct step is described in the previous section whereas the inverse is as follows</p>
<p class="formulaDsp">
\[ O(x,y)=\sum_{k=0}^{m}\sum_{l=0}^{n} F^d_{kl}A_k(x)B_l(y), \]
</p>
<p>where \(O\) is the output (reconstructed) image and \(d\) is F-transform degree. In fact, the algorithm computes the F-transform components of the input image \(I\) and spreads the components afterwards to the size of \(I\). For details see <a class="el" href="../../d0/de3/citelist.html#CITEREF_Perf:rec">[194]</a>. Application to image processing is possible to take from two different views.</p>
<h2>From pixel point of view </h2>
<p>The pixels are processed one by one in a way that appropriate basic functions are found for each of them. It will be exactly four, two in each direction. We need some helper structure in the memory for collecting their values. The values will be used in the nominator of the related fuzzy component. Implementation of this approach uses keyword <code>FL</code> as <b>fast</b> processing (because of more optimizations) and <b>linear basic function</b>.</p>
<div class="image">
<img src="../../fuzzy_pixel_view.jpg" alt="fuzzy_pixel_view.jpg"/>
<div class="caption">
Pixel point of view with marked basic functions related to processed pixel.</div></div>
 <h2>From fuzzy component point of view </h2>
<p>In this way, image is divided to the regular areas. Each area is processed separately using kernel window. This approach benefits from easy to understand, matrix based processing with straight forward parallelization.</p>
<div class="image">
<img src="../../fuzzy_BF_view.jpg" alt="fuzzy_BF_view.jpg"/>
<div class="caption">
Fuzzy component point of view with marked basic functions related to processed area.</div></div>
<p> This approach uses kernel \(g\). Let us show linear case with radius \(h = 2\) as an example.</p>
<p class="formulaDsp">
\[ A = (0, 0.5, 1, 0.5, 0) \\ B^T = (0, 0.5, 1, 0.5, 0) \\ g = AB^T=\left( \begin{array}{ccccc} 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\ 0 &amp; 0.25 &amp; 0.5 &amp; 0.25 &amp; 0 \\ 0 &amp; 0.5 &amp; 1 &amp; 0.5 &amp; 0 \\ 0 &amp; 0.25 &amp; 0.5 &amp; 0.25 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\ \end{array} \right) \]
</p>
 </div></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Apr 2 2021 11:36:38 for OpenCV by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
<script type="text/javascript">
//<![CDATA[
addTutorialsButtons();
//]]>
</script>
</body>
</html>
